<?php
/**
 * Created by 784855684@qq.com.
 * Link: https://github.com/lichtung/inframe
 * User: linzh
 * Date: 6/25/17
 * Time: 5:35 PM
 */



namespace inframe\core\Email;


use inframe\helper\traits\Magic;

/**
 * Class Email 信件内容
 * @package inframe\core\Email
 */
class Email
{

    use Magic;
    /**
     * 标题
     * @var string
     */
    private $title = '';
    /**
     * 信件内容
     * @var string
     */
    private $body = '';
    /**
     * 发送者账号
     * @var string
     */
    private $sender = '';
    /**
     * 发送者名称
     * @var string
     */
    private $senderName = '';
    /**
     * 抄送地址
     * @var string
     */
    private $replyto = '';
    /**
     * 抄送人名称
     * @var string
     */
    private $replytoName = '';
    /**
     * 接受者
     * @var array
     */
    private $receiver = [];

    public function __construct($title = 'Hello', $body = 'This is email for test!')
    {
        $this->title = $title;
        $this->body = $body;
    }

    /**
     * 添加收件人地址
     * @param string $receiver 收件人地址
     * @param string $name 收件人名称,默认为空
     * @return Email
     */
    public function addAddress($receiver, $name = '')
    {
        $this->receiver[] = [$receiver, $name];
        return $this;
    }

    /**
     * @return string
     */
    public function getReplytoName()    {
        return $this->replytoName;
    }

    /**
     * @param string $replytoName
     */
    public function setReplytoName($replytoName)
    {
        $this->replytoName = $replytoName;
    }

    /**
     * @return string
     */
    public function getReplyto()    {
        return $this->replyto;
    }

    /**
     * @param string $replyto
     */
    public function setReplyto($replyto)
    {
        $this->replyto = $replyto;
    }

    /**
     * @return string
     */
    public function getTitle()    {
        return $this->title;
    }

    /**
     * @param string $title
     */
    public function setTitle($title)
    {
        $this->title = $title;
    }

    /**
     * @return string
     */
    public function getBody()    {
        return $this->body;
    }

    /**
     * @param string $body
     */
    public function setBody($body)
    {
        $this->body = $body;
    }

    /**
     * @return string
     */
    public function getSender()    {
        return $this->sender;
    }

    /**
     * @param string $sender
     */
    public function setSender($sender)
    {
        $this->sender = $sender;
    }

    /**
     * @return string
     */
    public function getSenderName()    {
        return $this->senderName;
    }

    /**
     * @param string $senderName
     */
    public function setSenderName($senderName)
    {
        $this->senderName = $senderName;
    }

    /**
     * @return array
     */
    public function getReceiver()    {
        return $this->receiver;
    }
}